#include "ros/ros.h"
#include "std_msgs/String.h"
#include "std_msgs/Float64.h"

int main(int argc, char **argv) {
    ros::init(argc, argv, "talker");
    ros::NodeHandle n;
    ros::Publisher string_pub = n.advertise<std_msgs::String>("string_topic", 1000);
    ros::Publisher float_pub = n.advertise<std_msgs::Float64>("float_topic", 1000);
    ros::Rate loop_rate(1);
    int count = 0;
    while (ros::ok()) {
        std_msgs::String string_msg;
        std_msgs::Float64 float_msg;
        
        std::stringstream string_ss;
        string_ss << "hello world " << count;
        string_msg.data = string_ss.str();

        float_msg.data = 3.14; // Example float data
        
        ROS_INFO("String message: %s", string_msg.data.c_str());
        ROS_INFO("Float message: %f", float_msg.data);
        
        string_pub.publish(string_msg);
        float_pub.publish(float_msg);
        
        ros::spinOnce();
        loop_rate.sleep();
        count += 2;
    }
    return 0;
}

